package edu.xjdx.os.service.Impl;

import edu.xjdx.os.domain.*;
import edu.xjdx.os.mapper.GoodsMapper;
import edu.xjdx.os.mapper.OrderDetailMapper;
import edu.xjdx.os.mapper.OrderMapper;
import edu.xjdx.os.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderMapper orderMapper;
    @Autowired
    private OrderDetailMapper orderDetailMapper;
    @Autowired
    private GoodsMapper goodsMapper;
    @Override
    public List<Order> findAll() {
        return orderMapper.findAll();
    }

    @Override
    public void remove(String orderId) {
        orderMapper.deleteByPrimaryKey(orderId);
    }

    @Override
    public void modify(Order order) {
        orderMapper.updateByPrimaryKeySelective(order);
    }

    @Override
    public void add(Order order) {
        orderMapper.insert(order);
    }

    @Override
    public Order findById(String id) {
        return orderMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Order> findByCustomer(String customerId) {
        return orderMapper.findByCustomerId(customerId);
    }


}
